/*********************************************************
          File Name:10.21.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Fri 26 Feb 2016 07:31:32 PM CST
**********************************************************/

#include <iostream>

int main()
{
    int num = 3;
    auto f = [&num]() -> bool {
        if(num == 0)
            return true;
        num -= 1;
        return false;
    };

    std::cout << std::boolalpha << f() << std::endl;
    std::cout << std::boolalpha << f() << std::endl;
    std::cout << std::boolalpha << f() << std::endl;
    std::cout << std::boolalpha << f() << std::endl;

    return 0;
}
